<?php
# 
# relative to cms/builder

require_once(dirname(dirname(dirname(__FILE__))).'/appconf.php');
require_once 'CMS.class.php';

$local_config = array(
    'this_cgi'       => 'cms/builder/logout.php',
    'tmpl'           => '',
    'database'       => '',
    'table'          => '',
);

// Needed for our database connection
#require_once "CMS_Login.class.php";

class cms_logout extends CMS{

  function setup(){
    $this->run_modes('list'
                    );
    $this->start_mode('list');    
    parent::setup();
  }

  function cgiapp_prerun($rm){    
  }
  
  # for logout
  function action_list(){
  	$this->s_param("~CMS_logged-in", 0);
	  
	  require_once('CMS_LoginCookie.class.php');
	  $login_cookie = new CMS_LoginCookie();
    $login_cookie->clear();
    
  	if (file_exists($this->param('WWW').'cms/builder/index.php')) {
      return $this->redirect('/cms/builder/index.php');
    } 
  	return $this->redirect('/');
  }

}//end class

$webapp = new cms_logout(
   array('PARAMS' => array_merge($site_global_config, $local_config))
         );
$webapp->run();

?>
